<!DOCTYPE HTML>
<html>
<head>
    <include file="Public/head" />
<title>商品详情</title>
</head>
<body>
<div class="pd-20">
<form class="" name="form" id="form" action="__URL__/index/" method="get">
	<table class="table table-border table-bordered table-bg">
		<thead>
			<tr>
				<th scope="col" colspan="6">商品编码：{$detail.pro_no}</th>
			</tr>
		</thead>
		<tbody>
		<input type="hidden" name="goods_id" class="input-text" value="{$detail.id}">
			<tr class="text-c">
				<td width="15%" class="text-r" style="background-color:#f5f5f5">商品名称：</td>
				<td class="text-l">
				<input type="text" class="input-text radius " name="pro_name" id="pro_name" value="{$detail.pro_name}">
				</td>
				<td width="15%" class="text-r" style="background-color:#f5f5f5">账册编号</td>
				<td class="text-l">
				<input type="text" class="input-text radius " name="manua_id" id="manua_id" value="{$detail.manua_id}">
				</td>
				
									
			</tr>
			<tr class="text-c">
				<td width="15%" class="text-r" style="background-color:#f5f5f5">项号</td>
				<td class="text-l">
				<input type="text" class="input-text radius " name="item_no" id="item_no" value="{$detail.item_no}">
				</td>
				<td width="15%" class="text-r" style="background-color:#f5f5f5">料件性质</td>
				<td class="text-l">
				<input type="text" class="input-text radius " name="item_type" id="item_type" value="{$detail.item_type}">
				</td>	
			</tr>
			<tr class="text-c">
				<td width="15%" class="text-r" style="background-color:#f5f5f5">料号</td>
				<td class="text-l">
				<input type="text" class="input-text radius " name="source_no" id="source_no" value="{$detail.source_no}">
				</td>
				<td width="15%" class="text-r" style="background-color:#f5f5f5">商品规格，型号</td>
				<td class="text-l">
				<input type="text" class="input-text radius " name="pro_spec" id="pro_spec" value="{$detail.pro_spec}">
				</td>	
			</tr>
			<tr class="text-c">
				<td width="15%" class="text-r" style="background-color:#f5f5f5">币制</td>
				<td class="text-l">
				<select name="current_type" class="form-control select" style="width:130px">
                        <option value="">请选择</option>
                        <volist name="coin_list" id="vo">
                            <option value="{$vo.coin_code}" <if condition="$vo['coin_code'] eq $detail['current_type']"> selected</if>>{$vo.coin_name}</option>
                        </volist>
                    </select>
				
				</td>
				<td width="15%" class="text-r" style="background-color:#f5f5f5">申报计量单位</td>
				<td class="text-l">
				<select name="declare_unit" class="form-control select" style="width:130px">
                        <option value="">请选择</option>
                        <volist name="unit_list" id="vo">
                            <option value="{$vo.unit_no}" <if condition="$vo['unit_no'] eq $detail['declare_unit']"> selected</if>>{$vo.unit_name}</option>
                        </volist>
                    </select>
				</td>	
			</tr> 
			<tr class="text-c">
				<td width="15%" class="text-r" style="background-color:#f5f5f5">第一单位</td>
				<td class="text-l">
				<select name="unit1" class="form-control select" style="width:130px">
                        <option value="">请选择</option>
                        <volist name="unit_list" id="vo">
                            <option value="{$vo.unit_no}" <if condition="$vo['unit_no'] eq $detail['unit1']"> selected</if>>{$vo.unit_name}</option>
                        </volist>
                </select>
				</td>
				<td width="15%" class="text-r" style="background-color:#f5f5f5">第二单位</td>
				<td class="text-l">
				<select name="unit2" class="form-control select" style="width:130px">
                        <option value="">请选择</option>
                        <volist name="unit_list" id="vo">
                            <option value="{$vo.unit_no}" <if condition="$vo['unit_no'] eq $detail['unit2']"> selected</if>>{$vo.unit_name}</option>
                        </volist>
                 </select>
				</td>
			</tr>
			<tr class="text-c">
				<td width="15%" class="text-r" style="background-color:#f5f5f5">商品编码</td>
				<td class="text-l">
					<input type="text" class="input-text radius size-S" name="pro_no" id="pro_no"  value="{$detail.pro_no}" style="width:100px;">
				</td>	
				<td width="15%" class="text-r" style="background-color:#f5f5f5">生产成本价</td>
				<td class="text-l">
					<input type="text" class="input-text radius size-S " name="inbound_price" id="inbound_price" value="{$detail.inbound_price}" style="width:100px;">
				</td>	
			</tr>
			<tr class="text-c">
				<td width="15%" class="text-r" style="background-color:#f5f5f5">商品生产数量</td>
				<td class="text-l">{$detail.pro_num}</td>
				<td width="15%" class="text-r" style="background-color:#f5f5f5">实际入库数量</td>
				<td class="text-l">
					<input type="text" class="input-text radius size-S" name="receive_amount" id="receive_amount"  value="{$detail.receive_amount}" style="width:100px;">
				</td>	
			</tr>
		</tbody>
	</table>
	<button type="button" class="btn btn-primary radius grounding mt" style="float:left;"><i class="icon-plus"></i> 入库</button>	  
	<!-- <input type="button" class="btn btn-primary radius mt" id="edit" value="修改"> -->
	</form>

</div>
<script type="text/javascript">
	function validate(){
			var pro_name=$('input[name=pro_name]').val();
			var receive_amount=$('input[name=receive_amount]').val();
			var manua_id=$('input[name=manua_id]').val();
			var item_no=$('input[name=item_no]').val();
			var item_type=$('input[name=item_type]').val();
			var pro_no=$('input[name=pro_no]').val();
			var source_no=$('input[name=source_no]').val();
			
			if(pro_name==''){
				layer.msg('商品名称不能为空');
				return false;
			}
			if(manua_id==''){
				layer.msg('账册编码不能为空');
				return false;
			}
			if(item_no==''){
				layer.msg('项号不能为空');
				return false;
			}
			if(item_type==''){
				layer.msg('料件性质不能为空');
				return false;
			}
			if(source_no==''){
				layer.msg('料号不能为空');
				return false;
			}
			if(pro_no==''){
				layer.msg('商品编码不能为空');
				return false;
			}
			if(receive_amount==''){
				layer.msg('实际数量不能为空');
				return false;
			}

	}
    $(function(){
		/*修改商品成品价、预计销售价*/
		 $("#edit").click(function(){
			if(validate()==false){
				return false;
			}else{
				var pro_no=$('input[name=pro_no]').val();
				var receive_amount=$('input[name=receive_amount]').val();
			}
			
			
			layer.confirm('是否确定修改', {
			  btn: ['是','否']
			}, function(){
				$.ajax({
					type: 'POST',
					data: $("#form").serialize(),
					url: "{:U('editgood')}",
					success:function(data){
						layer.alert(data.info,function(){
							parent.window.location.href =parent.window.location.href;
						});
						
					}
				})
			});
		 })
        /*商品入库*/
        $(".grounding").click(function(){
            if(validate()==false){
				return false;
			}else{
				var pro_no=$('input[name=pro_no]').val();
				var receive_amount=$('input[name=receive_amount]').val();
			}

			layer.confirm('是否确定入库此商品', {
			  btn: ['是','否']
			}, function(){
				$.ajax({
					type: 'POST',
					data: $("#form").serialize(),
					url: "{:U('grounding')}",
					success:function(data){
						layer.alert(data.info,
											function(){
												parent.window.location.href =parent.window.location.href;
											});
						
					}
				})
			});
        });


    })
</script>
</body>
</html>